<?php
class ArticleIdentity{
    const ERROR_NONE=0;
    const ERROR_TITLE_INVALID=1;
    const ERROR_CONTENT_INVALID=2;
    const ERROR_UNKNOWN_IDENTITY=100;

    public $title;
    public $content;

    public $errorCode=self::ERROR_UNKNOWN_IDENTITY;

    public function __construct($title,$content){
        $this->title=$title;
        $this->content=$content;
    }

    public function check(){
        $title=$this->title;
        if(!$this->title)
            $this->errorCode=self::ERROR_TITLE_INVALID;
        else if(!$this->content)
            $this->errorCode=self::ERROR_CONTENT_INVALID;
        else{
            $this->errorCode=self::ERROR_NONE;
        }
        return $this->errorCode==self::ERROR_NONE;
    }
}
?>
